#define _CRT_SECURE_NO_WARNINGS   1

#include<iostream>
#include<vector>
#include<stack>
#include<string>

using namespace std;

class Solution {
public:
	vector<int> function(string s, int index)
	{
		stack<int> stack;
		int num = 0;
		char op = '+';
		int i;
		for (i = index; i < s.length(); i++)
		{
			if (isdigit(s[i]))
			{
				num = num * 10 + s[i] - '0';
				if (i != s.length() - 1)
					continue;
			}
			if (s[i] == '(')
			{
				vector<int> res = function(s, i + 1);
				num = res[0];
				i = res[1];
				if (i != s.length() - 1)
					continue;
			}
			switch (op)
			{
			case '+':
				stack.push(num);
				break;
			case '-':
				stack.push(-num);
				break;
			case '*':
				int temp = stack.top();
				stack.pop();
				stack.push(temp * num);
				break;
			}
			num = 0;
			if (s[i] == ')')
				break;
			else
				op = s[i];
		}
		int sum = 0;
		while (!stack.empty()){
			sum += stack.top();
			stack.pop();
		}
		return vector<int> {sum, i};
	}

	int solve(string s) 
	{
		return function(s, 0)[0];
	}
};

int main()
{
	Solution sol;
	string s;
	cin >> s;
	cout << sol.solve(s) << endl;
	return 0;
}